#pragma once
#include <iostream>

struct RealObject {
virtual void DoSomething() = 0; // interface
};

struct RealObjectImpl : RealObject {
void DoSomething() override {
  std::cout << "[DEBUG]: calling [RealObjectImpl::DoSomething()]" << std::endl;
}
};

struct ProxyObject {
  ProxyObject() : m_realObject{nullptr} {
    // TODO: inject 
    m_realObject = new RealObjectImpl();
  }

  ~ProxyObject() {
    delete m_realObject;
    m_realObject = nullptr;
  }

  // TODO: Proxy doing things now
  void DoThing() {
    if (m_realObject != nullptr) {
      m_realObject->DoSomething();
      std::cout << "Proxy pattern working, now hide the real object that runs its own method" << std::endl;
    }
  }

  private:
  RealObject* m_realObject;

};
